<!DOCTYPE html>
<html>
  <head>
    <title>DataScript script tag load test</title>

  </head>
  <body>
    <h1>DataScript script tag load test</h1>
    <p id='output'>Check the browser console for errors and output.</p>
    
    <script src="datahike.js"></script>
    <script>
      if (datahike) {
        console.log("DataScript loaded using a script tag");
        
        var d = datahike;
        var conn = d.create_conn();
        d.transact(conn, [[":db/add", -1, "name", "Ivan"]]);
        var res = d.q("[:find ?e ?v :where [?e \"name\" ?v]]", d.db(conn));
        var res_str = JSON.stringify(res);
        document.getElementById('output').innerHTML = res_str;
        console.log(res_str); // => [[1, "Ivan"]]
      }
    </script>
  </body>
</html>
